#include "ActionAgencyListen.h"
#include "agencymgr.h"
#include "log.h"
#include "ActionTopic.h"



void ActionAgencyListen::OnAgencyUpdate(const topic_proto::Topic& topic)
{
    log_debug("enter");
    if (AgencyMgr::Instance()->Get(topic.uuid()) == nullptr)
    {
        return;
    }
    agency_proto::Agency agency;
    if (!agency.ParseFromArray(topic.data().data(), topic.data().size()))
    {
        log_error("data parser agency_proto::Agency failed, %s", topic.ShortDebugString().c_str());
        return;
    }
    log_info("agency:%s", agency.ShortDebugString().c_str());
    stAgency st_agency;
    st_agency.CopyFrom(agency);
    AgencyMgr::Instance()->Update(std::move(st_agency));
}
















